/**
 *
 */
package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.DriverChoseLevelPaotuiMapper;
import com.ybkj.daijia.server.model.DriverChoseLevelPaotui;
import com.ybkj.daijia.server.service.DriverChoseLevelPaotuiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Shine
 *
 */
@Service
public class DefaultDriverChoseLevelPaotuiService implements DriverChoseLevelPaotuiService {

    @Autowired
    private DriverChoseLevelPaotuiMapper driverChoseLevelPaotuiMapper;

    @Transactional(rollbackFor = Exception.class)
    public DriverChoseLevelPaotui insertRecord(DriverChoseLevelPaotui driverChoseLevelPaotui) {

        driverChoseLevelPaotuiMapper.insertRecord(driverChoseLevelPaotui);

        return driverChoseLevelPaotui;

    }

    @Transactional(rollbackFor = Exception.class)
    public DriverChoseLevelPaotui updateByPrimaryKey(
        DriverChoseLevelPaotui driverChoseLevelPaotui) {

        driverChoseLevelPaotuiMapper.updateByPrimaryKey(driverChoseLevelPaotui);

        return driverChoseLevelPaotui;
    }

    @Override
    public DriverChoseLevelPaotui findByDriverAndLevelAndCompany(Long driverId, Long driverLevelId,
        Long companyId) {

        return driverChoseLevelPaotuiMapper.selectByPrimaryKey(driverId, driverLevelId, companyId);
    }

    @Override
    public DriverChoseLevelPaotui findByDriverAndCompany(Long driverId, Long companyId) {

        return driverChoseLevelPaotuiMapper.selectByDriverAndCompany(driverId, companyId);
    }

    @Transactional(rollbackFor = Exception.class)
    public void delete(Long driverId, Long driverLevelId) {
        driverChoseLevelPaotuiMapper.deleteByDriverAndDriverLevel(driverId, driverLevelId);
    }


    @Transactional(rollbackFor = Exception.class)
    public void deleteByDriver(Long driverId) {

        driverChoseLevelPaotuiMapper.deleteByDriver(driverId);

    }


    @Transactional(rollbackFor = Exception.class)
    public void deleteByDriverLevel(Long driverLevelId) {

        driverChoseLevelPaotuiMapper.deleteByDriverLevel(driverLevelId);

    }

    @Override
    public DriverChoseLevelPaotui findOne(Long id) {

        return null;
    }


}